<?php

namespace App\Http\Controllers;

use App\Log;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

abstract class Controller extends BaseController {
	use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

	/**
	 * 用户操作记录
	 * @param [type] $active [动作]
	 * @param [type] $class  [操作对象]
	 * @param [type] $id     [对象ID]
	 */
	protected function setLog($active, $class, $id) {
		$log = new Log;
		$log->user_id = session('id');
		$log->active = $active;
		$log->class = $class;
		$log->class_id = $id;
		$log->save();
	}
}
